package cn.fl.warrant.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cmm.mid.core.framework.page.Pager;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.utils.BaseLogUtils;
import cn.cmm.base.framework.utils.CollectionUtils;
import cn.cmm.base.framework.utils.StringUtils;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.warrant.service.IArcBorrowDetailService;
import cn.fl.warrant.transform.ArcBorrowDetailVOTransform;
import cn.fl.warrant.vo.ArcBorrowDetailVO;
import fl.warrant.facade.archive.api.IArcBorrowDetailApiService;
import fl.warrant.facade.archive.condition.ArcBorrowDetailQueryCondition;
import fl.warrant.facade.archive.dto.ArcBorrowDetailDTO;

/**
 * @Description: 借阅申请明细表(旧表：T_API_DOCUMENT_BORROW_DETAIL) 客户端服务层接口实现
 * @Description: 业务层方法名称前缀：新增：add* 删除：remove* 修改：modify* 查询对象：select* get* 批量：batch* 查询集合：search*
 */
@Service
public class ArcBorrowDetailServiceImpl implements IArcBorrowDetailService {

	private static final Logger logger = LoggerFactory.getLogger(IArcBorrowDetailService.class);
	
	@Autowired
	private IArcBorrowDetailApiService arcBorrowDetailApiService;

	@Override
	public ArcBorrowDetailVO selectById(Long id) throws BaseException{
		if(StringUtils.isEmpty(id)){
			BaseLogUtils.info(logger, "selectById", "主键参数不能为空!", CurrentThreadContext.getCurrentUserName());
			return null;
		}
		return ArcBorrowDetailVOTransform.toVO(arcBorrowDetailApiService.selectById(id));
	}

	@Override
	public Long add(ArcBorrowDetailVO entity) throws BaseException{
		if(null == entity){
			BaseLogUtils.info(logger, "add", "新增对象不能为空!", CurrentThreadContext.getCurrentUserName());
			return null;
		}
		//return this.arcBorrowDetailApiService.add(ArcBorrowDetailVOTransform.toDTO(entity));
		//TODO 业务逻辑
		return null;
	}

	@Override
	public boolean removeById(Long id) throws BaseException{
		if(StringUtils.isEmpty(id)){
			BaseLogUtils.info(logger, "removeById", "删除主键参数不能为空!", CurrentThreadContext.getCurrentUserName());
			return false;
		}
		//return this.arcBorrowDetailApiService.removeById(id);
		//TODO 业务逻辑
		return false;
	}
	
	/**
     * 删除
     * @param ids
     * @return
     */
    public boolean removeByIds(List<Long> ids)throws BaseException{
    	if(CollectionUtils.isEmpty(ids)){
    		BaseLogUtils.info(logger, "removeByIds", "删除主键参数集合不能为空!", CurrentThreadContext.getCurrentUserName());
			return false;
		};
		return false;
    }

	@Override
	public boolean modify(ArcBorrowDetailVO entity) throws BaseException{
		if(null == entity){
			BaseLogUtils.info(logger, "modify", "修改对象参数不能为空!", CurrentThreadContext.getCurrentUserName());
			return false;
		}
		return arcBorrowDetailApiService.modify(ArcBorrowDetailVOTransform.toDTO(entity));
	}

	@Override
	public Pager searchListPage(Pager page) throws BaseException{
		if(null == page)page = new Pager();
		//return this.arcBorrowDetailApiService.searchListPage(page);
		//TODO 业务逻辑
		return null;
	}
	
	/**
	 * 查询所有
	 * @param qc
	 * @return
	 * @throws BaseException
	 */
	public List<ArcBorrowDetailVO> searchList(ArcBorrowDetailQueryCondition qc)
			throws BaseException {
		return  ArcBorrowDetailVOTransform.toVOList(arcBorrowDetailApiService.searchList(qc));
	}
}
